import request from '../request';
import { getBase64 } from '@/utils/transform';

/**
 * 验证码接口
 * @returns string
 */
export const getVerifyCode = async () => {
  let verifyCode = '';
  const data = await request.get('/getVerifyCode', {
    responseType: 'blob',
  });
  verifyCode = await getBase64(data);
  return verifyCode;
};

/**
 * 登陆接口
 * @returns Object
 */
export const login = async (loginForm) => {
  const data = await request.post('/login', loginForm);
  return data.data;
};

/**
 * 登陆接口
 * @returns Object
 */
export const logoutApi = async () => {
  const data = await request.get('/logout');
  return data.data;
};

/**
 * 获取按钮权限
 * @returns Object
 */
export const getButton = async (empId) => {
  const data = await request.get(`/auth/employee/router/${empId}`);
  return data.data;
};
